package com.stu.core.service;

import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.stu.core.mysite_core.SessionUtil;
import com.stu.entity.mysite_enity.User;

public class HibernateTest {

	private static final Logger logger = Logger.getLogger(HibernateTest.class); 
	public static void main(String[] args) {
		Session session = SessionUtil.getSession();
		Transaction tx =  session.beginTransaction();
		String hql="from User user";
		List list= session.createQuery(hql).list();
		for(int i=0;i<list.size();i++){
			User obj=(User)list.get(i);  
			System.out.println(obj.getName());
		}
		logger.debug("mes!");
	}

}
